Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use full output-path on convert mdapi #1091

Merged
merged 2 commits into from
Jul 18, 2024
Merged

Conversation

cristiand391
Copy link
Member

What does this PR do?

Fix a bug where project convert mdapi --output-dir path/to/output would save the converted metadata to path instead of path/to/output if the path didn't exist before.

When the dir doesn't exist we create it for the user but the code was returning fs.promises.mkdir response which only returned the first dir in the path:
https://nodejs.org/api/fs.html#fspromisesmkdirpath-options

Updated convert NUT to check that the filepath starts with the full output path.

What issues does this PR fix or reference?

@W-15097291@

@@ -90,6 +90,10 @@ describe('project convert mdapi NUTs', () => {
expect(result.jsonOutput?.status).to.equal(0);
expect(result.jsonOutput?.result).to.be.an('array').with.length.greaterThan(10);
expect(fs.existsSync(convertedToSrcPath)).to.be.true;
expect(result.jsonOutput).to.not.be.undefined;
result.jsonOutput?.result.forEach((md) => {
expect(md.filePath.startsWith(convertedToSrcPath)).to.be.true;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This NUT was testing that the output dir was created in L92 (which is true) but the metadata was still written to the first dir in the path.

Screenshot 2024-07-15 at 7 29 28 PM

@WillieRuemmele
Copy link
Contributor

QA Notes


the NUT should suffice...

✅ : validated source format was extracted to nested output-dir
image

path from current
path2 from local

@WillieRuemmele WillieRuemmele merged commit d1aa2a3 into main Jul 18, 2024
38 checks passed
@WillieRuemmele WillieRuemmele deleted the cd/fix-output-dir branch July 18, 2024 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants